package com.whh.entity;

public class ResultEntity{

	private Boolean success;
	
	private Object data;
	
	private String msg;
	
	private Integer page;//页码
	
	private Integer total;//总页数
	
	private Integer rows;//每页记录数
	
	private Long records;//总记录数

	public ResultEntity() {
		super();
	}

	public ResultEntity(Boolean success) {
		super();
		this.success = success;
		this.msg = "操作完成";
	}

	public ResultEntity(Boolean success, Object data) {
		super();
		this.success = success;
		this.data = data;
		this.msg = "操作完成";
	}
	public ResultEntity(Boolean success, Object data,String msg) {
		super();
		this.success = success;
		this.data = data;
		this.msg = msg;
	}
	public Boolean getSuccess() {
		return success;
	}

	public void setSuccess(Boolean success) {
		this.success = success;
	}

	public Object getData() {
		return data;
	}

	public void setData(Object data) {
		this.data = data;
	}
	
	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public void setSucc() {
		setSucc("操作成功");
	}
	
	public void setSucc(String msg) {
		this.msg=msg;
		this.success=Boolean.TRUE;
	}
	
	public void setErr() {
		setErr("操作失败");
	}
	
	public void setErr(String msg) {
		this.msg=msg;
		this.success=Boolean.FALSE;
	}
	
	public void setWarn(String msg) {
		this.msg = msg;
		this.success=Boolean.TRUE;
	}

	public Integer getPage() {
		return page;
	}

	public void setPage(Integer page) {
		this.page = page;
	}

	public Integer getTotal() {
		return total;
	}

	public void setTotal(Integer total) {
		this.total = total;
	}

	public Integer getRows() {
		return rows;
	}

	public void setRows(Integer rows) {
		this.rows = rows;
	}

	public Long getRecords() {
		return records;
	}

	public void setRecords(Long records) {
		this.records = records;
		if(this.records!=null && this.rows !=null && this.total==null) {
			long a = this.records.longValue();
			long b = this.rows.longValue();
			double c = a/(double)b;
			int d = Double.valueOf(Math.ceil(c)).intValue();
			this.total = Integer.valueOf(d);
		}
	}
	
}
